home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGASIC
/
BASFILES.LZH
/
GETLINE.BAS
< prev
next >
Wrap
BASIC Source File
|
1988-09-10
|
2KB
|
68 lines
'$INCLUDE:'QBTOOLS.INC'
SUB GetLine (Disp%(), tr%, lc%, br%, rc%, crow%, ccol%, sl%(), addr%, atb%, el%) STATIC
' Number of elements in array
IF crow% > br% THEN ' It's past end
el% = 0 ' No values
EXIT SUB
END IF
addr% = (crow% - 1) * 80 + ccol% ' get the address
ch% = Disp%(addr%) ' and the value at this add
IF ccol% = rc% THEN ' Last column for the line
el% = 2
CALL SpltByte(ch%, sl%(2), sl%(1)) ' Split to attribute & character
atb% = 1 ' No optimization
ccol% = lc% ' Increase to next line...
crow% = crow% + 1
EXIT SUB
END IF
'
' NOW, loop through the line, checking whether it's a OPTIMIZE or
' NORMAL type.
'
FOR k% = addr% + 1 TO (crow% - 1) * 80 + rc% ' to end of line
IF Disp%(k%) <> ch% THEN
EXIT FOR
END IF
NEXT k%
k% = k% - 1 ' To calculate the number
dup% = k% - addr% ' Number of duplicates
IF dup% = 0 THEN ' No duplicates
CALL SpltByte(ch%, sl%(2), sl%(1)) ' First value
el% = 2
FOR k% = ccol% + 1 TO rc%
chd% = (crow% - 1) * 80 + k%
IF k% <> rc% THEN
IF Disp%(chd%) = Disp%(chd% + 1) THEN
EXIT FOR
END IF
END IF
el% = el% + 2
CALL SpltByte(Disp%(chd%), sl%(el%), sl%(el% - 1))'
NEXT k%
ccol% = k%
IF ccol% > rc% THEN
ccol% = lc%
crow% = crow% + 1
END IF
atb% = el% / 2
ELSE ' Yes, there are duplicates
CALL SpltByte(ch%, sl%(2), sl%(1)) '
el% = 2
atb% = 128 + dup%
ccol% = ccol% + dup%
END IF
END SUB